<template>
  <a-modal v-model:visible="visible" :width="1000">
    <template #footer>
      <a-button v-if="examineVisible" key="back" type="primary" @click="handleExamine(1)">通过</a-button>
      <a-button v-if="examineVisible" key="submit" type="primary" :loading="loading" @click="handleExamine(2)">拒绝</a-button>
    </template>
    <div class="form-container" ref="formRefpdf2" id="formRefpdf2" style="width: 100%">
      <header class="form-header">
        <!-- <h1>附件</h1> -->
        <h2>2025年上海市崇明区城桥中学招收艺体特长生报名信息详情表</h2>
        <div class="school-info" style="font-weight: bold; font-size: 22px">
          <span>{{ formList.district }}</span> 区 <span>{{ formList.school }}</span> 学校
        </div>
        <!-- <p style="text-align: left">本人承诺，以上填报信息均属实。</p> -->
      </header>
      <div class="form-body">
        <table class="registration-table">
          <tr>
            <td width="100">学生姓名</td>
            <td width="150">
              {{ formList.actualName }}
            </td>
            <td width="130">中考报名号</td>
            <td width="200">
              {{ formList.registerNum }}
            </td>
            <td rowspan="4" width="120" class="photo-cell">
              <div class="photo-container">
                <img :src="photoUrl" alt="照片预览" class="photo-preview" @click.stop="previewImage(photoUrl)" />
              </div>
              <div v-if="showPreview" class="image-preview-modal" @click="closePreview">
                <img :src="previewImageSrc" alt="图片预览" class="preview-modal-image" />
              </div>
            </td>
          </tr>
          <tr>
            <td>性别</td>
            <td>
              {{ formList.gender == 1 ? '男' : '女' }}
            </td>
            <td>身份证号</td>
            <td>
              {{ formList.card }}
            </td>
          </tr>
          <tr>
            <td>班级职务</td>
            <td>
              {{ formList.position }}
            </td>
            <td>户籍地址</td>
            <td>
              {{ formList.houseLocation }}
            </td>
          </tr>
          <tr>
            <td>政治面貌</td>
            <td>
              {{ formList.political }}
            </td>
            <td>居住地址</td>
            <td>
              {{ formList.address }}
            </td>
          </tr>
          <tr>
            <td>监护人称谓</td>
            <td>姓名</td>
            <td>联系电话</td>
            <td colspan="2">工作单位</td>
          </tr>
          <tr>
            <td>
              {{ formList.guardianTitle }}
            </td>
            <td>
              {{ formList.guardianName }}
            </td>
            <td>
              {{ formList.phone }}
            </td>
            <td colspan="2">
              {{ formList.workplace }}
            </td>
          </tr>
          <tr>
            <td>
              {{ formList.guardianTitle2 }}
            </td>
            <td>
              {{ formList.guardianName2 }}
            </td>
            <td>
              {{ formList.phone2 }}
            </td>
            <td colspan="2">
              {{ formList.workplace2 }}
            </td>
          </tr>

          <tr>
            <td rowspan="2">本学年一模考试成绩</td>
            <td colspan="4">
              <div class="signature-line">
                <div>
                  <span>语文：</span>
                  <span class="signature-input" style="width: 40px">
                    {{ formList.language }}
                  </span>

                  <span style="margin-left: 100px">数学：</span>
                  <span class="signature-input" style="width: 40px">
                    {{ formList.maths }}
                  </span>
                  <span style="margin-left: 100px">英语：</span>
                  <span class="signature-input" style="width: 40px">
                    {{ formList.english }}
                  </span>
                </div>
              </div>
            </td>
          </tr>

          <tr>
            <!-- <td colspan="4"></td> -->
          </tr>

          <tr>
            <td rowspan="3" style="text-align: center">特长情况</td>
          </tr>
          <tr>
            <td colspan="4">{{ formList.subcategories }}</td>
          </tr>

          <!-- <tr>
            <td rowspan="7" style="text-align: center">特长佐证材料</td>
          </tr> -->

          <tr></tr>
          <tr>
            <td :rowspan="getLength(formList.talentfileEntities)" style="text-align: center">特长佐证材料</td>
          </tr>
          <tr>
            <td colspan="1" style="text-align: center">成绩或证书获取时间</td>
            <td colspan="1" style="text-align: center">成绩或证书名称</td>
            <td colspan="1" style="text-align: center">成绩或证书名次或等级</td>
            <td colspan="1" style="text-align: center">图片附件</td>
          </tr>

          <tr v-for="(item, index) in formList.talentfileEntities" :key="index">
            <td>{{ item.issuanceDate }}</td>
            <td>
              {{ item.issuanceDepartment }}
            </td>
            <td>
              {{ item.awardName }}
            </td>
            <!-- <td colspan="2" style="width: 100px; height: 100px">
              <img :src="item.talentFileUrl" alt="照片预览" style="width: 100px; height: 100px" />
            </td> -->
            <td class="photo-cell" style="width: 50px; height: 50px">
              <div style="width: 50px; height: 50px">
                <img :src="item.talentFileUrl" alt="照片预览" class="photo-preview" @click.stop="previewImage(item.talentFileUrl)" />
              </div>
              <div v-if="showPreview" class="image-preview-modal" @click="closePreview">
                <img :src="previewImageSrc" alt="图片预览" class="preview-modal-image" />
              </div>
            </td>
          </tr>

          <tr>
            <!-- <td colspan="4"></td> -->
          </tr>

          <tr>
            <td :rowspan="getLength(formList.certificateEntities)" style="text-align: center">其他获奖及荣誉</td>
          </tr>
          <tr>
            <td style="text-align: center">获奖时间</td>
            <td style="text-align: center">奖项名称</td>
            <td style="text-align: center">成绩或证书等级</td>
            <td style="text-align: center">图片附件</td>
          </tr>

          <tr v-for="(item, index) in formList.certificateEntities" :key="index">
            <td>
              {{ item.issuanceDate }}
            </td>
            <td>
              {{ item.issuanceDepartment }}
            </td>
            <td>
              {{ item.awardName }}
            </td>
            <!-- <td colspan="2" style="width: 100px; height: 100px">
              <img :src="item.certificateUrl" alt="照片预览" style="width: 100px; height: 100px" />
            </td> -->
            <td class="photo-cell" style="width: 50px; height: 50px">
              <div style="width: 50px; height: 50px">
                <img :src="item.certificateUrl" alt="照片预览" class="photo-preview" @click.stop="previewImage(item.certificateUrl)" />
              </div>
              <div v-if="showPreview" class="image-preview-modal" @click="closePreview">
                <img :src="previewImageSrc" alt="图片预览" class="preview-modal-image" />
              </div>
            </td>
          </tr>

          <!-- <tr>
            <td style="text-align: center">成绩或证书获取时间</td>
            <td style="text-align: center">成绩或证书名称</td>
            <td style="text-align: center" colspan="2">成绩或证书名次或等级</td>
          </tr>
          <tr>
            <td>{{ formList.issuanceDate4 }}</td>
            <td>{{ formList.issuanceDepartment4 }}</td>
            <td colspan="2">{{ formList.awardName4 }}</td>
            <tr>
                <td>{{ formData.issuanceDate4 }}</td>
                <td>{{ formData.issuanceDepartment4 }}</td>
                <td>{{ formData.awardName4 }}</td>
              </tr>
          </tr>

          <tr>
            <td>{{ formList.issuanceDate5 }}</td>
            <td>{{ formList.issuanceDepartment5 }}</td>
            <td colspan="2">{{ formList.awardName5 }}</td>
          </tr>
          <tr>
            <td>{{ formList.issuanceDate6 }}</td>
            <td>{{ formList.issuanceDepartment6 }}</td>
            <td colspan="2">{{ formList.awardName6 }}</td>
          </tr>

          <tr>
            <td>{{ formList.issuanceDate7 }}</td>
            <td>{{ formList.issuanceDepartment7 }}</td>
            <td colspan="2">{{ formList.awardName7 }}</td>
          </tr>

          <tr>
            <td>{{ formList.issuanceDate8 }}</td>
            <td>{{ formList.issuanceDepartment8 }}</td>
            <td colspan="2">{{ formList.awardName8 }}</td>
          </tr>
          <tr></tr>

          <tr>
            <td rowspan="5" style="text-align: center">其他获奖及荣誉</td>
          </tr>
          <tr>
            <td style="text-align: center">获奖时间</td>
            <td colspan="2" style="text-align: center">奖项名称</td>
            <td style="text-align: center">成绩或证书等级</td>
          </tr>
          <tr>
            <td>{{ formList.issuanceDate }}</td>
            <td>{{ formList.issuanceDepartment }}</td>
            <td colspan="2">{{ formList.awardName }}</td>
          </tr>
          <tr>
            <td>{{ formList.issuanceDate2 }}</td>
            <td>{{ formList.issuanceDepartment2 }}</td>
            <td colspan="2">{{ formList.awardName2 }}</td>
          </tr>
          <tr>
            <td>{{ formList.issuanceDate3 }}</td>
            <td>{{ formList.issuanceDepartment3 }}</td>
            <td colspan="2">{{ formList.awardName3 }}</td>
          </tr> -->

          <tr>
            <!-- <td colspan="4"></td> -->
          </tr>
          <tr>
            <td rowspan="2">报考承诺</td>
            <td colspan="4" class="declaration-cell">
              <span>本人承诺，以上填报信息均属实。</span>
              <div class="signature-line">
                <div>
                  <span>学生签字：</span>
                  <span class="signature-input">
                    <!-- <input v-model="formList.studentSignature" type="text" placeholder="请签名"> -->
                  </span>

                  <span style="margin-left: 100px">监护人签字：</span>
                  <span class="signature-input">
                    <!-- <input v-model="formList.guardianSignature" type="text" placeholder="请签名"> -->
                  </span>
                </div>
                <!-- <div>
                  <span>监护人签字：</span>
                  <span class="signature-input">
                    
                  </span>
                </div> -->
              </div>
              <div class="date-line">
                <span>{{ formData.signatureYear }}</span> 年 <span>{{ formData.signatureMonth }}</span> 月 <span>{{ formData.signatureDay }}</span> 日
              </div>
            </td>
          </tr>
          <tr>
            <!-- <td colspan="4"></td> -->
          </tr>
          <tr>
            <td rowspan="2">学校审核</td>
            <td colspan="4" class="school-review-cell">
              <p>初中学校审核意见：</p>
              <div class="school-seal">
                学校盖章
                <div class="date-line school-date">
                  <span>{{ formData.schoolYear }}</span> 年 <span>{{ formData.schoolMonth }}</span> 月 <span>{{ formData.schoolDay }}</span> 日
                </div>
              </div>
            </td>
          </tr>
          <tr>
            <!-- <td colspan="4"></td> -->
          </tr>
          <tr>
            <td>备注</td>
            <td colspan="4" class="note-cell">
              <p>填报完成后，此表由学生本人及监护人签字确认，并由初中学校审核盖章，入围校测的学生于校测当日交至招生学校。</p>
            </td>
          </tr>
        </table>
      </div>
    </div>
  </a-modal>
</template>

<script setup>
import { message } from 'ant-design-vue';
import _ from 'lodash';
import { nextTick, reactive, ref, onMounted } from 'vue';
import { enterpriseApi } from '/@/api/business/oa/enterprise-api';
import AreaCascader from '/@/components/framework/area-cascader/index.vue';
import { SmartLoading } from '/@/components/framework/smart-loading';
import Upload from '/@/components/support/file-upload/index.vue';
import { regular } from '/@/constants/regular-const';
import { smartSentry } from '/@/lib/smart-sentry';
import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';
import { registrationReviewApi } from '/@/api/registrationReview/index';
import { loginApi } from '/@/api/system/login-api';

defineExpose({
  showModal,
});
const emit = defineEmits(['refresh']);
const baseUrl = import.meta.env.VITE_APP_API_URL;
//岗位代码
const jobCodeList = ['教师岗位', '其他专业技术岗位', '管理岗位', '工勤技能岗位', '特设岗位', '无其他岗位'];
// 政治面貌
const politicalList = ['中共党员', '中共预备党员', '共青团员', '群众', '其他政治面貌'];
// 婚姻状况
const maritalList = ['未婚', '已婚', '离异', '丧偶'];
// 英语等级
const englishList = ['一级', '二级', '三级', '四级', '五级', '六级', '七级', '八级', '九级'];
// 普通话等级
const mandarinList = ['一级甲等', '一级乙等', '二级甲等', '二级乙等', '三级甲等', '三级乙等'];
// 教师资格证类别
const teacherCardTypeList = [
  '幼儿园教师资格',
  '小学教师资格',
  '初级中学教师资格 ',
  '高级中学教师资格',
  '中等职业学校教师资格',
  '中等职业学校实习指导教师资格',
  '高等学校教师资格',
];
// 教师资格证学科
const SubjectList = ['幼儿园', '小学', '初中', '高中'];
//学位
const academicDegreeList = ['学士', '硕士', '博士'];
// 学历
const educationList = ['本科', '硕士研究生', '博士研究生'];
const ethnicGroupList = ref([]);
const registerTypeList = ref([]);
const registerSchoolList = ref([]);
const formList = ref([]);
const dataSource1 = ref([]);
const dataSource2 = ref([]);
// 表单数据
const formData = reactive({
  picUrl: '',
  district: '',
  school: '',
  actualName: '',
  registerNum: '',
  gender: '',
  card: '',
  position: '',
  houseLocation: '',
  political: '',
  address: '',
  score: '',
  language: '',
  maths: '',
  english: '',
  other: '',
  guardianTitle: '',
  guardianName: '',
  phone: '',
  workplace: '',
  guardianTitle2: '',
  guardianName2: '',

  issuanceDate: '',
  issuanceDepartment: '',
  awardName: '',
  certificateUrl: '',

  issuanceDate2: '',
  issuanceDepartment2: '',
  awardName2: '',
  certificateUrl2: '',

  issuanceDate3: '',
  issuanceDepartment3: '',
  awardName3: '',
  certificateUrl3: '',

  issuanceDate4: '',
  issuanceDepartment4: '',
  awardName4: '',
  certificateUrl4: '',

  issuanceDate5: '',
  issuanceDepartment5: '',
  awardName5: '',
  certificateUrl5: '',

  issuanceDate6: '',
  issuanceDepartment6: '',
  awardName6: '',
  certificateUrl6: '',

  issuanceDate7: '',
  issuanceDepartment7: '',
  awardName7: '',
  certificateUrl7: '',

  issuanceDate8: '',
  issuanceDepartment8: '',
  awardName8: '',
  certificateUrl8: '',

  phone2: '',
  workplace2: '',
  remark: '',
  subcategories: null,
  signatureYear: new Date().getFullYear(),
  signatureMonth: new Date().getMonth() + 1,
  signatureDay: new Date().getDate(),
  schoolYear: new Date().getFullYear(),
  schoolMonth: new Date().getMonth() + 1,
  schoolDay: new Date().getDate(),
});
const columns1 = ref([
  {
    title: '入学时间',
    dataIndex: 'enrollmentDate',
    key: 'enrollmentDate',
  },
  {
    title: '毕业时间',
    dataIndex: 'graduationDate',
    key: 'graduationDate',
  },
  {
    title: '所在学校',
    dataIndex: 'school',
    key: 'school',
  },
  {
    title: '职务',
    dataIndex: 'post',
    key: 'post',
  },
]);
const columns2 = ref([
  {
    title: '颁发时间',
    dataIndex: 'issuanceDate',
    key: 'issuanceDate',
  },
  {
    title: '成绩或证书等级',
    dataIndex: 'issuanceDepartment',
    key: 'issuanceDepartment',
  },
  {
    title: '奖项名称',
    dataIndex: 'awardName',
    key: 'awardName',
  },
  {
    title: '等级',
    dataIndex: 'grade',
    key: 'grade',
  },
]);
// --------------------- modal 显示与隐藏 ---------------------
// 是否展示
const visible = ref(false);
const examineVisible = ref(false);
const id = ref(null);
function showModal(enterpriseId, type) {
  Object.assign(form, formDefault);
  area.value = [];
  if (enterpriseId) {
    id.value = enterpriseId;
    detail(enterpriseId);
  }
  if (type) {
    examineVisible.value = true;
  }
  visible.value = true;
}
const showPreview = ref(false); // 控制预览模态框的显示
const previewImageSrc = ref(''); // 存储点击图片的 URL
// 处理图片点击，预览图片
function previewImage(imageSrc) {
  previewImageSrc.value = imageSrc;
  showPreview.value = true;
}

// 关闭预览
function closePreview() {
  showPreview.value = false;
}

function onClose() {
  dataSource1.value = [];
  dataSource2.value = [];
  visible.value = false;
}
const stuInfo = ref({
  score: ['', '', ''],
  talent: [{ subcategories: '' }],
});
const photoUrl = ref('');
const fileUrl1 = ref([]);
const fileUrl2 = ref([]);
const fileUrl21 = ref([]);
const fileUrl22 = ref([]);
const fileUrl23 = ref([]);
const fileUrl24 = ref([]);
const fileUrl25 = ref([]);
const fileUrl26 = ref([]);
const fileUrl27 = ref([]);
const fileUrl28 = ref([]);

function getLength(list) {
  if (list) {
    return list.length + 2 || 0;
  }
  return 2;
}
async function detail(enterpriseId) {
  dataSource1.value = [];
  dataSource2.value = [];
  try {
    let res = await registrationReviewApi.detail({ employeeId: enterpriseId });
    let data = res.data;
    formList.value = data;
    if (data.resumeEntities && data.resumeEntities.length) {
      dataSource1.value = data.resumeEntities;
    }
    if (data.certificateEntities && data.certificateEntities.length) {
      dataSource2.value = data.certificateEntities;
    }
    if (res) {
      stuInfo.value = res.data;
      formList.value.actualName = res.data.actualName;
      formList.value.registerNum = res.data.registerNum;
      formList.value.gender = res.data.gender;
      formList.value.card = res.data.card;
      formList.value.position = res.data.position;
      formList.value.houseLocation = res.data.houseLocation;
      formList.value.political = res.data.political;
      formList.value.address = res.data.address;
      photoUrl.value = res.data.picUrl;

      if (res.data.juniorHighSchool) {
        console.log(res.data);

        formList.value.district = res.data.juniorHighSchool.split(',')[0];
        formList.value.school = res.data.juniorHighSchool.split(',')[1];
      }

      for (let i = 0; i < res.data.guardian.length; i++) {
        if (i == 0) {
          formList.value.guardianTitle = res.data.guardian[0].guardianTitle;
          formList.value.guardianName = res.data.guardian[0].guardianName;
          formList.value.phone = res.data.guardian[0].phone;
          formList.value.workplace = res.data.guardian[0].workplace;
        } else if (i == 1) {
          formList.value.guardianTitle2 = res.data.guardian[1].guardianTitle;
          formList.value.guardianName2 = res.data.guardian[1].guardianName;
          formList.value.phone2 = res.data.guardian[1].phone;
          formList.value.workplace2 = res.data.guardian[1].workplace;
        }
      }
      var score = res.data.score;

      if (score) {
        formList.value.language = score.split(',')[0];
        formList.value.maths = score.split(',')[1];
        formList.value.english = score.split(',')[2];
      }

      if (res.data.talent) {
        formList.value.subcategories = res.data.talent[0].subcategories;
      }
      formList.value.remark = res.data.remark;

      let zlist = res.data.talentfileEntities;
      if (res.data.talentfileEntities) {
        formList.value.issuanceDate4 = zlist[0].issuanceDate;
        formList.value.issuanceDepartment4 = zlist[0].issuanceDepartment;
        formList.value.awardName4 = zlist[0].awardName;
        fileUrl24.value.push(zlist[0].talentFileUrl);
      }
      if (zlist) {
        if (zlist.length - 1 >= 1) {
          formList.value.issuanceDate5 = zlist[1].issuanceDate;
          formList.value.issuanceDepartment5 = zlist[1].issuanceDepartment;
          formList.value.awardName5 = zlist[1].awardName;
          fileUrl25.value.push(zlist[1].talentFileUrl);
        }
        if (zlist.length - 1 >= 2) {
          formList.value.issuanceDate6 = zlist[2].issuanceDate;
          formList.value.issuanceDepartment6 = zlist[2].issuanceDepartment;
          formList.value.awardName6 = zlist[2].awardName;
          fileUrl26.value.push(zlist[2].talentFileUrl);
        }
        if (zlist.length - 1 >= 3) {
          formList.value.issuanceDate7 = zlist[3].issuanceDate;
          formList.value.issuanceDepartment7 = zlist[3].issuanceDepartment;
          formList.value.awardName7 = zlist[3].awardName;
          fileUrl27.value.push(zlist[3].talentFileUrl);
        }
        if (zlist.length - 1 >= 4) {
          formList.value.issuanceDate8 = zlist[4].issuanceDate;
          formList.value.issuanceDepartment8 = zlist[4].issuanceDepartment;
          formList.value.awardName8 = zlist[4].awardName;
          fileUrl28.value.push(zlist[4].talentFileUrl);
        }
      }

      let clist = res.data.certificateEntities;
      if (clist) {
        if (clist.length - 1 >= 0) {
          formList.value.issuanceDate = clist[0].issuanceDate;
          formList.value.issuanceDepartment = clist[0].issuanceDepartment;
          formList.value.awardName = clist[0].awardName;
          fileUrl21.value.push(clist[0].certificateUrl);
        }

        if (clist.length - 1 >= 1) {
          formList.value.issuanceDate2 = clist[1].issuanceDate;
          formList.value.issuanceDepartment2 = clist[1].issuanceDepartment;
          formList.value.awardName2 = clist[1].awardName;
          fileUrl22.value.push(clist[1].certificateUrl);
        }
        if (clist.length - 1 >= 2) {
          formList.value.issuanceDate3 = clist[2].issuanceDate;
          formList.value.issuanceDepartment3 = clist[2].issuanceDepartment;
          formList.value.awardName3 = clist[2].awardName;
          fileUrl23.value.push(clist[2].certificateUrl);
        }
      }
    }
  } catch (error) {
    smartSentry.captureError(error);
  } finally {
    SmartLoading.hide();
  }
}
function handleExamine(type) {
  try {
    registrationReviewApi.confirm({ employeeId: id.value, isPass: type });
    message.success(`审核成功`);
    emit('refresh');
    onClose();
  } catch (error) {
    smartSentry.captureError(error);
  } finally {
    SmartLoading.hide();
  }
}
// --------------------- 表单 ---------------------

//  组件
const formRef = ref();

const formDefault = {
  enterpriseId: undefined,
  enterpriseName: undefined,
  unifiedSocialCreditCode: undefined,
  businessLicense: undefined,
  contact: undefined,
  enterpriseLogo: undefined,
  contactPhone: undefined,
  email: undefined,
  province: undefined,
  provinceName: undefined,
  city: undefined,
  cityName: undefined,
  district: undefined,
  districtName: undefined,
  address: undefined,
  disabledFlag: false,
};
let form = reactive({ ...formDefault });
const rules = {
  enterpriseName: [{ required: true, message: '请输入企业名称' }],
  unifiedSocialCreditCode: [{ required: true, message: '请输入统一社会信用代码' }],
  contact: [{ required: true, message: '请输入联系人' }],
  contactPhone: [
    { required: true, message: '请输入联系人电话' },
    { pattern: regular.phone, message: '请输入正确的联系人电话', trigger: 'blur' },
  ],
  type: [{ required: true, message: '请选择类型' }],
};

function onSubmit() {
  formRef.value
    .validate()
    .then(async () => {
      SmartLoading.show();
      try {
        if (form.enterpriseId) {
          await enterpriseApi.update(form);
        } else {
          await enterpriseApi.create(form);
        }
        message.success(`${form.enterpriseId ? '修改' : '添加'}成功`);
        emit('refresh');
        onClose();
      } catch (error) {
        smartSentry.captureError(error);
      } finally {
        SmartLoading.hide();
      }
    })
    .catch((error) => {
      console.log('error', error);
      message.error('参数验证错误，请仔细填写表单数据!');
    });
}

// 状态
const enabledChecked = ref(true);

function enabledCheckedChange(checked) {
  form.disabledFlag = !checked;
}

// 地区
const area = ref([]);

function changeArea(value, selectedOptions) {
  Object.assign(form, {
    province: '',
    provinceName: '',
    city: '',
    cityName: '',
    district: '',
    districtName: '',
  });
  if (!_.isEmpty(selectedOptions)) {
    // 地区信息
    form.province = area.value[0].value;
    form.provinceName = area.value[0].label;

    form.city = area.value[1].value;
    form.cityName = area.value[1].label;
    if (area.value[2]) {
      form.district = area.value[2].value;
      form.districtName = area.value[2].label;
    }
  }
}

function enterpriseLogoChange(fileList) {
  form.enterpriseLogo = fileList;
}

function businessLicenseChange(fileList) {
  form.businessLicense = fileList;
}

function getSchoole(options, id) {
  let label = '';
  options.forEach((i) => {
    if (i.value == id) {
      label = i.label;
    }
  });
  return label;
}
function downloadFile() {
  let link = document.createElement('a'); // 创建下载的实体标签
  link.href = baseUrl + '/upload/' + formList.value.fileUrl; // 创建下载的链接
  link.download = '附件' + '.zip'; // 下载的文件名
  link.click(); // 执行下载
  link.remove();
}
onMounted(async () => {
  const res = await loginApi.ethnicGroupSelect();
  // formList.value[22].options = res.data.data.map((i) => {
  //   return i.ethnicGroupName;
  // });

  // const registerType = await loginApi.schoolType();
  // formList.value[1].options = registerType.data.rows.map(i => {
  //     return i.MC
  // });

  // const schooleList = await loginApi.schoolList();
  // formList.value[2].options = schooleList.data.rows.map(i => {
  //     // return i.ORGNAME
  //     return { label: i.ORGNAME, value: i.id }
  // });
});
</script>

<style lang="less" scoped>
.form-width {
  width: 100% !important;
}

.footer {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}

:deep(.ant-card-body) {
  padding: 10px;
}

:where(.css-dev-only-do-not-override-1r8ax8d).ant-form-item {
  margin-bottom: 0px !important;
}
</style>
